package com.flot.yazb.model.user;

import com.flot.yazb.base.model.BModel;
import com.flot.yazb.base.client.RetrofitFactory;
import com.flot.yazb.aop.stub.StringCallBack;
import com.flot.yazb.aop.stub.RMCallback;
import com.flot.yazb.aop.stub.RMResponse;
import com.flot.yazb.retrofit.service.BService;
import com.flot.yazb.widget.utils.ToastUtil;



public class RegistModel extends BModel {

    public static void regist(final Transit<RegistModel> incubator) {
        RetrofitFactory.getInstance()
                .create(BService.UserService.class)
                .regist()
                .enqueue(new RMCallback<RMResponse<RegistModel>>(incubator.getContext()) {
                    @Override
                    protected void onSuccess(RMResponse<RegistModel> result) {
                        incubator.onBorn(result.content, result.code(), result.message());
                    }

                    @Override
                    protected void onFail(String errorCode, String errorInfo) {
                        incubator.onBorn(null, errorCode, errorInfo);
                    }
                });
    }

    public static void regist1(final Transit<RegistModel> incubator) {
        RetrofitFactory.getInstance()
                .create(BService.UserService.class)
                .regist1()
                .enqueue(new StringCallBack<RegistModel>(incubator.getContext()) {

                    @Override
                    protected void onSuccess(RegistModel rmodel) {
                        ToastUtil.showToast(incubator.getContext(),rmodel.userid+"  "+rmodel.code()+" "+rmodel.message());
                    }

                    @Override
                    protected void onFail(String errorCode, String errorInfo) {

                    }
                });
    }

    public String userid;

}
